﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RatesCalculator.aspx.cs" Inherits="StreetSmartAdmin.RatesCalculator" %>
<%@ Register TagPrefix="CustUserCtrl" TagName="Header" Src="Header.ascx" %>
<%@ Register TagPrefix="CustUserCtrl" TagName="Footer" Src="Footer.ascx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Rates Calculator</title>
<link type="text/css" rel="stylesheet" href="style.css" />

    <style type="text/css">
table.table1{
    font-family: "Trebuchet MS", sans-serif;
    font-size: 16px;
    font-weight: bold;
    line-height: 1.4em;
    font-style: normal;
    border-collapse:separate;
    
}
.table1 thead th{
    padding:15px;
    color:#fff;
    text-shadow:1px 1px 1px #568F23;
    border:1px solid #93CE37;
    border-bottom:3px solid #9ED929;
    background-color:#9DD929;
    background:-webkit-gradient(
        linear,
        left bottom,
        left top,
        color-stop(0.02, rgb(123,192,67)),
        color-stop(0.51, rgb(139,198,66)),
        color-stop(0.87, rgb(158,217,41))
        );
    background: -moz-linear-gradient(
        center bottom,
        rgb(123,192,67) 2%,
        rgb(139,198,66) 51%,
        rgb(158,217,41) 87%
        );
    -webkit-border-top-left-radius:5px;
    -webkit-border-top-right-radius:5px;
    -moz-border-radius:5px 5px 0px 0px;
    border-top-left-radius:5px;
    border-top-right-radius:5px;
}
.table1 thead th:empty{
    background:transparent;
    border:none;
}
.table1 tbody th{
    color:#fff;
    text-shadow:1px 1px 1px #568F23;
    background-color:#9DD929;
    border:1px solid #93CE37;
    border-right:3px solid #9ED929;
    padding:0px 10px;
    background:-webkit-gradient(
        linear,
        left bottom,
        right top,
        color-stop(0.02, rgb(158,217,41)),
        color-stop(0.51, rgb(139,198,66)),
        color-stop(0.87, rgb(123,192,67))
        );
    background: -moz-linear-gradient(
        left bottom,
        rgb(158,217,41) 2%,
        rgb(139,198,66) 51%,
        rgb(123,192,67) 87%
        );
    -moz-border-radius:5px 0px 0px 5px;
    -webkit-border-top-left-radius:5px;
    -webkit-border-bottom-left-radius:5px;
    border-top-left-radius:5px;
    border-bottom-left-radius:5px;
}
.table1 tfoot td{
    color: #9CD009;
    font-size:32px;
        background-color:#DEF3CA;
    text-align:center;
    padding:10px 0px;
    text-shadow:1px 1px 1px #444;
}
.table1 tfoot th{
    color:#fff;
    text-shadow:1px 1px 1px #568F23;
    background-color:#9DD929;
    border:1px solid #93CE37;
    border-right:3px solid #9ED929;
    padding:0px 10px;
    background:-webkit-gradient(
        linear,
        left bottom,
        right top,
        color-stop(0.02, rgb(158,217,41)),
        color-stop(0.51, rgb(139,198,66)),
        color-stop(0.87, rgb(123,192,67))
        );
    background: -moz-linear-gradient(
        left bottom,
        rgb(158,217,41) 2%,
        rgb(139,198,66) 51%,
        rgb(123,192,67) 87%
        );
    -moz-border-radius:5px 0px 0px 5px;
    -webkit-border-top-left-radius:5px;
    -webkit-border-bottom-left-radius:5px;
    border-top-left-radius:5px;
    border-bottom-left-radius:5px;
}
.table1 tbody td{
    padding:10px;
    text-align:center;
    background-color:#DEF3CA;
    border: 2px solid #E7EFE0;
    -moz-border-radius:2px;
    -webkit-border-radius:2px;
    border-radius:2px;
    color:#666;
    text-shadow:1px 1px 1px #fff;
} 
    </style>

</head>
<body>
    <form id="form1" runat="server" >
       <CustUserCtrl:Header ID="Header" runat="server"></CustUserCtrl:Header>
    <div>
     <center>

            <h2>Rates Calculator</h2>
            <div id="table_container">
            <div id="tb1">
            <table class="table1" >
                <thead>
                    <tr>
                        
                        <th scope="col" colspan="1">Fuel</th>
                        <th scope="col" colspan="1">Customer</th>
                        <th scope="col" colspan="1">Bill</th>
                        <th scope="col" colspan="1">Plan</th> 
                        <th scope="col" colspan="1">Postcode</th> 
                    </tr>

                </thead>

                <tbody>
                    <tr>
                        
                        <td colspan="1">
                            <asp:DropDownList ID="FuelType" runat="server"  Width="140px" Font-Bold="True" 
                                            Font-Size="Medium" AutoPostBack="True">
                                <asp:ListItem Selected="True">Electricity</asp:ListItem>
                                <asp:ListItem>Gas</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td colspan="1">
                            <asp:DropDownList ID="OrgType" runat="server"  Width="140px" Font-Bold="True" 
                                            Font-Size="Medium" AutoPostBack="True">
                                <asp:ListItem Selected="True">Residential</asp:ListItem>
                                <asp:ListItem>Business</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td colspan="1">
                            <asp:DropDownList ID="DropDownList5" runat="server"  Width="140px" Font-Bold="True" 
                                            Font-Size="Medium">
                                <asp:ListItem Selected="True">Monthly</asp:ListItem>
                                <asp:ListItem>Quarterly</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td colspan="1">
                            <asp:DropDownList ID="Plan" runat="server"  Width="140px" Font-Bold="True" 
                                            Font-Size="Medium" DataSourceID="SqlDataSource2" 
                                DataTextField="PLAN_TYPE" DataValueField="PLAN_TYPE">
                                
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:SQLServer2005DBConnectionString %>" 
                                
                                SelectCommand="SELECT DISTINCT [PLAN_TYPE] FROM [Plan_Type] WHERE (([FUEL] = @FUEL) AND ([CUSTOMER] = @CUSTOMER) AND ([STATE] = @STATE))">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="FuelType" Name="FUEL" PropertyName="SelectedValue" 
                                        Type="String" />
                                    <asp:ControlParameter ControlID="OrgType" Name="CUSTOMER" 
                                        PropertyName="SelectedValue" Type="String" />
                                    <asp:ControlParameter ControlID="ddlState" Name="STATE" 
                                        PropertyName="SelectedValue" Type="String" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                        </td>
                        <td colspan="1">
                            <asp:DropDownList ID="ddlState" runat="server" AutoPostBack="True" 
                                Font-Size="Medium" Font-Bold="True">
                                <asp:ListItem Selected="True">NSW</asp:ListItem>
                                <asp:ListItem>VIC</asp:ListItem>
                                <asp:ListItem>QLD</asp:ListItem>
                                <asp:ListItem>SA</asp:ListItem>
                                <asp:ListItem>ACT</asp:ListItem>
                            </asp:DropDownList>
                            <asp:DropDownList ID="SelPostcode" runat="server" 
                                DataSourceID="SqlDataSource1" DataTextField="Postcode" Font-Bold="True" Width="140px"
                                DataValueField="Postcode" Font-Size="Medium">
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:SQLServer2005DBConnectionString %>" 
                                
                                SelectCommand="SELECT DISTINCT [Postcode] FROM [Discount] WHERE ([State] = @State)">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="ddlState" Name="State" 
                                        PropertyName="SelectedValue" Type="String" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                        </td>
                    </tr>
                    <tr>
                        
                        <th scope="row"  colspan="3">Energy Usage</th>
                        <th scope="row"  colspan="2">On Bill</th>
                        
                        
                    </tr>
                    <tr>
                    
                        <th scope="row" colspan="1">Peak</th>
                        <th scope="row" colspan="1">Shoulder</th>
                        <th scope="row" colspan="1">Off Peak</th>
                        <th scope="row" colspan="1">Charges</th>
                        <th scope="row" colspan="1">Days</th>
                        
                    </tr>
                    
                    <tr>
                        
                        <td>
                            <asp:TextBox ID="PeakUsage" runat="server"  Width="110px"  Style="text-align: center" ></asp:TextBox>
                            <br />
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                ErrorMessage="Numbers Only" ControlToValidate="PeakUsage" 
                                ValidationExpression="\d+"  ValidationGroup="Group1"></asp:RegularExpressionValidator>
                        </td>
                        <td>
                            <asp:TextBox ID="Shoulder" runat="server"  Width="110px"  Style="text-align: center"></asp:TextBox>
                            <br />
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                                ErrorMessage="Numbers Only" ControlToValidate="Shoulder"
                                ValidationExpression="\d+"  ValidationGroup="Group1"></asp:RegularExpressionValidator>
                        </td>
                        <td>
                            <asp:TextBox ID="OffPeakUsage" runat="server"  Width="110px"  Style="text-align: center"></asp:TextBox>
                            <br />
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                                ErrorMessage="Numbers Only" ControlToValidate="OffPeakUsage"
                                ValidationExpression="\d+"  ValidationGroup="Group1"></asp:RegularExpressionValidator>
                        </td>
                        <td>
                            <asp:TextBox ID="Bill" runat="server"  Width="110px"  Style="text-align: center" ></asp:TextBox>
                            <br />
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" 
                                ErrorMessage="Numbers Only" ControlToValidate="Bill"
                                ValidationExpression="\d+"  ValidationGroup="Group1"></asp:RegularExpressionValidator>
                        </td>
                        <td>
                            <asp:TextBox ID="DaysOnBill" runat="server"  Width="110px"  Style="text-align: center"  ></asp:TextBox>
                            <br />
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" 
                                ErrorMessage="Numbers Only" ControlToValidate="DaysOnBill"
                                ValidationExpression="\d+"  ValidationGroup="Group1"></asp:RegularExpressionValidator>
                        </td>
                    </tr>
                    
                    
                   

                    <tr>
                        
                        <td colspan="5">
                            <asp:Button ID="btnCal" runat="server" BackColor="#9DD929" Font-Bold="True" 
                                Font-Italic="True" Font-Size="Medium" ForeColor="#FF5050" Text="Calculate" 
                                onclick="btnCal_Click"  />

                            </td>
                    </tr>


                </tbody>
                
            </table>
            </div>

            <br/>
            <br/>

            <div id="tb2">
            <table class="table1">
                <thead>
                    <tr>
                        <th rowspan="2" colspan="1" >
                            <img alt="" src="images/logo.jpg" Width="150px" 
                                style="opacity:0.4;filter:alpha(opacity=40);"/></th>
                        <th scope="col" abbr="Starter" colspan="4">Per Bill</th>
                        <th scope="col" abbr="Medium" rowspan="2">Per Year</th>
                        
                    </tr>
                    <tr>

                        <th scope="col">Peak</th>
                        <th scope="col">Shoulder</th>
                        <th scope="col">Off Peak</th>
                        <th scope="col">Supply</th>


                    </tr>
                </thead>

                <tbody>
                    <tr>
                       
                        <th scope="row">Price (excl. GST)</th>
                        <td><asp:Label ID="PeakCharge" runat="server" Text=""></asp:Label></td>
                        <td><asp:Label ID="ShoulderCharge" runat="server" Text=""></asp:Label></td>
                        <td><asp:Label ID="OffPeakCharge" runat="server" Text=""></asp:Label></td>
                        <td><asp:Label ID="SupplyCharge" runat="server" Text=""></asp:Label></td>
                        <td rowspan="2">
                            <asp:Label ID="OurPricePerYear" runat="server"></asp:Label></td>

                    </tr>
                    <tr>
                        <th scope="row">Total (incl. GST)</th>
                        <td colspan="4">
                            <asp:Label ID="OurPrice" runat="server" Text=""></asp:Label></td>
                       


                    </tr>

                </tbody>
                <tfoot>
                    <tr>
                        <th scope="row" colspan="1">Final Savings</th>
                        <td colspan="4"><asp:Label ID="SavePerBill" runat="server" Text=""></asp:Label></td>
                        <td><asp:Label ID="SavePerYear" runat="server" Text=""></asp:Label></td>


                    </tr>
                </tfoot>
            </table>
            </div>
            </div>

            <br/>
            <br/>
            <br/>
                        
   


    </center>
    
    </div>
    </form>
</body>
<script src="RatesCalculator.js" type="text/javascript"></script>
</html>
